import { domainService } from '~/config/server';
import { NetService } from '~/utils/net.service';
import { Inject, Debounce } from '~/core/decorator';
import { FilterService } from '~/utils/filter.service';
export class CaseRepaymentService {
  @Inject(NetService)
  private netService: NetService;

  /**
   * 新增还款记录
   */
  public addCaseRepayment(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.addCaseRepayment,
      data: {
        caseId: data.id,
        repayAmount: data.repaymentAmount
      }

    });
  }
  /**
   * 新增还款记录批量
   */
  @Debounce()
  public addCaseRepaymentBatch(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.addCaseRepaymentBatch,
      data: {
        caseRepaymentRequests: data
      }
    });
  }
  /**
   * 还款记录查询
   */
  @Debounce()
  public selectCaseRepayment(data, page) {
    return this.netService.send({
      server: domainService.caseRepaymentController.selectCaseRepayment,
      data: {
        caseNumber: data.caseNumber,
        entryTimeMin: FilterService.dateRanageFormat(data.entryTime).start,
        entryTimeMax: FilterService.dateRanageFormat(data.entryTime).end,
        caseId: data.caseId,
        repayAmountMin: data.repayAmount ? data.repayAmount.min : '',
        repayAmountMax: data.repayAmount ? data.repayAmount.max : '',
        repaymentAcctname: data.repaymentAcctname,
        repaymentAcctno: data.repaymentAcctno,
        collectorRealName: data.collectorRealName,
        deptName: data.deptName
      },
      page
    })
  }
  /**
   * 导出还款记录
   */
  @Debounce()
  public exportCaseRepayment(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.exportCaseRepayment,
      data: {
        caseNumber: data.caseNumber,
        caseRepaymentMethod: data.caseRepaymentMethod,
        entryTimeMin: FilterService.dateRanageFormat(data.createTime).start,
        entryTimeMax: FilterService.dateRanageFormat(data.createTime).end,
        idCard: data.idCard,
        mobileNo: data.mobileNo,
        name: data.name,
        personalName: data.personalName
      }
    })
  }
  /**
   * 还款总金额统计
   */
  @Debounce()
  public caseRepaymentAmount(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.caseRepaymentAmount,
      data: {
        caseNumber: data.caseNumber,
        caseRepaymentMethod: data.caseRepaymentMethod,
        entryTimeMin: FilterService.dateRanageFormat(data.createTime).start,
        entryTimeMax: FilterService.dateRanageFormat(data.createTime).end,
        idCard: data.idCard,
        mobileNo: data.mobileNo,
        name: data.name,
        personalName: data.personalName
      }
    })
  }
  /**
   * 新增还款申请
   */
  @Debounce()
  public addCaseRepaymentApply(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.addCaseRepaymentApply,
      data
    });
  }
  /**
   * 获取收款账户
   */
  @Debounce()
  public getReceiveAccount(paymentType: string, caseTaskId: string) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getReceiveAccount,
      data: { paymentType, caseTaskId }
    })
  }

  /**
   * 回款列表
   */
  public getAllPaymentConfirmationList(data, page, sort?) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getAllPaymentConfirmationList,
      data,
      page,
      sort
    })
  }

  /**
   * 回款确认
   */
  public confirmCaseRepaymentApply(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.confirmCaseRepaymentApply,
      data
    })
  }
  /**
   * 报表管理-回款明细报表
   */
  public getCaseRepaymentDetailReport(data, page) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getCaseRepaymentDetailReport,
      data,
      page
    })
  }
  /**
   * 报表管理-佣金报表
   */
  public getCommissionReport(data, page) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getCommissionReport,
      data,
      page
    })
  }
  /**
   * 报表管理-佣金报表金额统计
   */
  public getCommissionReportAmount(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getCommissionReportAmount,
      data
    })
  }
  /**
   * 报表管理-绩效报表
   */
  public getPerformanceReport(data, page) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getPerformanceReport,
      data,
      page
    })
  }
  /**
   * 报表管理-绩效报表金额统计
   */
  public getPerformanceReportAmount(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.getPerformanceReportAmount,
      data
    })
  }
  /**
   * 绩效报表导出
   */
  public performanceReportExport(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.performanceReportExport,
      data
    })
  }

  /**
   * 佣金报表导出
   */
  public commissionReportExport(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.commissionReportExport,
      data
    })
  }
  /**
   * 回款明细报表导出
   */
  public caseRepaymentDetaiReportExport(data) {
    return this.netService.send({
      server: domainService.caseRepaymentController.caseRepaymentDetaiReportExport,
      data
    })
  }

}
